home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-05-31 | 1.4 KB | 74 lines | [TEXT/CWIE] |
- //Copyright (c) 1997 Aidan Cully
- //All rights reserved
-
- #include "CLPicControl.h"
-
- TPicControl::TPicControl( TLayoutBranch *super, SInt16 resID ):
- TControl( super )
- {
- mhResid= resID;
- picture= 0l;
- }
-
- Boolean TPicControl::Init()
- {
- picture= GetCIcon( mhResid );
- if( picture != 0 )
- return( TControl::Init() );
- return( 0 );
- }
-
- void TPicControl::DrawSelf( TDrawSlate *gr )
- {
- Rect localRect= GetLocalRect();
- Rect iconRect;
-
- iconRect.left= (localRect.left+localRect.right)/2;
- iconRect.top= (localRect.top+localRect.bottom)/2;
- iconRect.left -= 16;
- iconRect.right= iconRect.left+32;
- iconRect.top -= 16;
- iconRect.bottom= iconRect.top+32;
- EraseRect( &localRect );
- FrameRoundRect( &localRect, 16, 16 );
- PlotCIcon( &iconRect, picture );
- }
-
- Boolean TPicControl::Close()
- {
- if( picture )
- DisposeCIcon( picture );
- return( TControl::Close() );
- }
-
- void TPicControl::TrackMouseChange( TMouseEvent *event, Boolean within )
- {
- Rect rect= GetLocalRect();
-
- ::InsetRect( &rect, 1, 1 );
- InvertRoundRect( &rect, 14, 14 );
- }
-
- void TPicControl::TrackMouseUp( TMouseEvent *event )
- {
- Rect rect= GetLocalRect();
-
- ::InsetRect( &rect, 1, 1 );
- InvertRoundRect( &rect, 14, 14 );
- }
-
- void TPicControl::TrackMouseDown( TMouseEvent *event )
- {
- Rect rect= GetLocalRect();
-
- ::InsetRect( &rect, 1, 1 );
- InvertRoundRect( &rect, 14, 14 );
- }
-
- Rect TPicControl::GetLargestSize()
- {
- Rect retRect;
-
- ::SetRect( &retRect, 0, 0, 40, 40 );
- return( retRect );
- }